Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validation for FastBoot, there is no window or document in fastboot env #6

Merged
merged 3 commits into from
Jul 28, 2018

Conversation

betocantu93
Copy link
Contributor

@betocantu93 betocantu93 commented Jun 28, 2018

Prevents window or document code in fastboot env

Return 0 in fastboot, some people (me) cache the resulting html and without 0, the menu is displayed open in the cached version, so no width solved the issue.

@nickschot
Copy link
Owner

I'll take a look at this in the weekend. I might want to solve this in the getWindowWidth function instead as that prevents any future accidental use.

@nickschot nickschot added bug Something isn't working and removed bug Something isn't working labels Jul 5, 2018
@betocantu93
Copy link
Contributor Author

Yes, that should work too, I also had to place ua-parser under dependencies in package.json and whitelist it in fastbootDependencies

{
  "name": "my-sweet-app",
  "version": "0.4.2",
  "devDependencies": {
    // ...
  },
  "dependencies": {
    "ua-parser-js": "^0.7.14"
  },
  "fastbootDependencies": [
    "ua-parser-js": "^0.7.14"
  ]
}

@nickschot
Copy link
Owner

I have reviewed what is necessary for FastBoot support and think this is the only change necessary. All event handlers are only added in a didInsertElement hook which isn't called in FastBoot, so all that should be fine. I will soon add FastBoot specific tests.

I am slightly surprised you need to add that dependency as the useragent addon should have FastBoot support. Will take a look at that too. Else we'll have to document it.

Thanks for the PR!

@nickschot nickschot merged commit 5774163 into nickschot:master Jul 28, 2018
@nickschot
Copy link
Owner

@betocantu93 just to come back to this: when adding fastboot tests I also stumbled upon the ua-parser-js error. Am investigating how best to solve this issue in the addon! See #12 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants